package com.devmindset.legoframework.usage.client;

import com.devmindset.legoframework.client.mvc.LanguageService;

/**
 * Native service 'javascript-to-java' binder.
 * 
 * @author <a href="ice.penov@devmindset.com">Ice Penov</a>
 */
public final class NativeService {
	
	private NativeService() {}
	
	public static void init() {		
		//add your js-to-java method calls here.
		toEnglishEvent();
		toGermanEvent();
	}
	
  public static native void toGermanEvent() /*-{
  	$wnd.toGermanEvent = function () {
    	@com.devmindset.legoframework.usage.client.NativeService::toGermanEventHandler()();
  	};
 	}-*/;
  
  public static native void toEnglishEvent() /*-{
  	$wnd.toEnglishEvent = function () {
    	@com.devmindset.legoframework.usage.client.NativeService::toEnglishEventHandler()();
  	};
 	}-*/;
  
  public static void toGermanEventHandler() {
  	LanguageService.toLanguage("de");
  	LanguageService.appendLocale();
  }
	
  public static void toEnglishEventHandler() {
  	LanguageService.toLanguage("en");
  	LanguageService.appendLocale();
  }

}